const express = require("express");
const bodyParser = require('body-parser')

const app = express();

app.use(express.static(__dirname + '/public'));


// 定义获取请求体中间件（全局或者路由 都可）
// app.use(bodyParser.urlencoded({ extended: false }))
let urlencodedparser = bodyParser.urlencoded({ extended: false })

app.get('/login', (req, res) => {
    res.sendFile(__dirname + '/public/index.html')
})

app.post('/login', urlencodedparser,(req, res) => {
    console.log(req.body);
    res.send('登录成功')
})

app.listen(9527, () => {
    console.log('启动成功...');
})